<!-- if $session.user_id -->
<div class="am-panel am-panel-default">
	<div class="am-panel-hd">
		<div class="am-g am-g-collapse">
			<div class="am-u-sm-4">收件人信息</div>
			<div class="am-u-sm-8"><input type="button" value="添加新地址" onclick="$.address.add()" class="am-btn am-btn-secondary am-fr am-btn-xs" /></div>
		</div>
	</div>
	<!-- if $address_list -->
	<ul class="am-list am-list-static">
		<!-- loop from=$address_list key=$key value=$value id=$tmpid -->
		<li>
			<div class="am-g am-g-collapse">
				<div class="am-u-sm-1"><input type="radio" name="address_id" id="address_id_{$value.id}" value="{$value.id}"{if $address_id == $value.id} checked{/if} onclick="load_freight()" /></div>
				<div class="am-u-sm-11">
					<div class="am-g">
						<div class="am-u-sm-12"><label for="address_id_{$value.id}">{$value.fullname}</label></div>
						<div class="am-u-sm-12">{$value.province}<!-- if $value.province != $value.city -->{$value.city}<!-- /if -->{$value.county}{$value.address}</div>
						<div class="am-u-sm-12">
							<!-- if $value.mobile -->
							{func substr $value.mobile 0 3}****{func substr $value.mobile -3}
							<!-- /if -->
						</div>
					</div>
				</div>
				<div class="am-u-sm-12">
					<div class="am-fr">
						<input type="button" value="编辑" onclick="$.address.edit('{$value.id}')" class="am-btn am-btn-xs" />
						<!-- if !$value.is_default -->
						<input type="button" value="设为默认" class="am-btn am-btn-xs" onclick="$.address.set_default('{$value.id}')" />
						<!-- /if -->
					</div>
				</div>
			</div>
		</li>
		<!-- /loop -->
	</ul>
	<!-- /if -->
	<!-- if $address_id -->
	<script type="text/javascript">
	$(document).ready(function(){
		load_freight();
	});
	</script>
	<!-- /if -->
</div>
<!-- else -->
<div class="am-panel am-panel-default">
	<div class="am-panel-hd">收件人信息</div>
	<div class="am-panel-bd">
		<div class="am-form-group">
			<label for="fullname" class="am-u-sm-2 am-form-label">收件人</label>
			<div class="am-u-sm-10">
				<input type="text" id="fullname" name="fullname" placeholder="填写收件人姓名"/>
			</div>
		</div>
		<div class="am-form-group address">
			<label for="fullname" class="am-u-sm-2 am-form-label">地址</label>
			<div class="am-u-sm-10">
				<div class="pca">{$pca_rs}</div>
				<input type="text" name="address" id="address" value="{$rs.address}" style="margin-top:3px;" />
			</div>
		</div>
		<div class="am-form-group">
			<label for="mobile" class="am-u-sm-2 am-form-label">手机号码</label>
			<div class="am-u-sm-10">
				<input type="tel" id="mobile" name="mobile" value="{$rs.mobile}" placeholder="填写有效的手机号码" />
			</div>
		</div>
		<div class="am-form-group">
			<label for="tel" class="am-u-sm-2 am-form-label">固定电话</label>
			<div class="am-u-sm-10"><input type="tel" id="tel" name="tel" value="{$rs.tel}" placeholder="填写有效的固定电话，带上区号，示例：0755-12345678" /></div>
		</div>
		<div class="am-form-group">
			<label for="email" class="am-u-sm-2 am-form-label">邮箱 Email</label>
			<div class="am-u-sm-10"><input type="email" id="email" name="email" value="{$rs.email}" placeholder="用来接收订单提醒邮件，便于您及时了解订单状态" /></div>
		</div>
	</div>
</div>
<script type="text/javascript">
var old_province = '';
var old_city = '';
function monitor_address()
{
	var p = $("#pca_p").val();
	var c = $("#pca_c").val();
	if(p && c && (p != old_province || c != old_city)){
		load_freight();
		old_province = p;
		old_city = c;
	}
	window.setTimeout('monitor_address()',1000);
}
$(document).ready(function(){
	monitor_address();
});
</script>
<!-- /if -->